<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./../template/WorkspaceTemplate.xhtml">

    <ui:define name="top">

    </ui:define>

    <ui:define name="left">

    </ui:define>

    <ui:define name="right">

    </ui:define>

    <ui:define name="content">
        <h:form id="orderListForm" style="font-size: 85%">
            <h2>View Order List</h2>
            <br/>
            <p:panel>
                <p:messages  />
                <br/>
                <br/>
                <br/>

                <h:outputText value="Today's Confirmed Orders" style="font-weight: bold; font-size: 110%"/>
                <p:separator/>
                <br/>
                <p:dataTable var="rec" value="#{lcManagerBean.confirmedOrderList}" paginator="true" rows="10" selection="#{lcManagerBean.selected}">

                    <p:column sortBy="#{rec.deliveryOrderIdStr}">
                        <f:facet name="header">
                            <h:outputText value="Delivery Order #" />  
                        </f:facet>  
                        <h:outputText value="#{rec.deliveryOrderIdStr}" />  

                    </p:column>

                    <p:column sortBy="#{rec.status}">  
                        <f:facet name="header">  
                            <h:outputText value="Order Status" />  
                        </f:facet>  
                        <h:outputText value="#{rec.status}" />  
                    </p:column>

                    <p:column sortBy="#{rec.leadTimeTS}">  
                        <f:facet name="header">  
                            <h:outputText value="Shipping Date" />  
                        </f:facet>  
                        <h:outputText value="#{rec.leadTimeTS}">
                            <f:convertDateTime pattern="dd-MMM-yyyy"/>
                        </h:outputText>
                    </p:column>

                    <p:column selectionMode="multiple"/>

                    <f:facet name="footer">  
                        <p:commandButton value="Process Order" image="ui-icon ui-icon-clipboard" actionListener="#{lcManagerBean.processOrder}" update="orderListForm"/>  
                    </f:facet>
                </p:dataTable>

                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <h:outputText value="Order Processing" style="font-weight: bold; font-size: 110%"/>
                <p:separator/>
                <br/>
                <p:dataTable var="rec" value="#{lcManagerBean.processingOrderList}" paginator="true" rows="10">

                    <p:column sortBy="#{rec.deliveryOrderIdStr}">
                        <f:facet name="header">
                            <h:outputText value="Delivery Order #" />  
                        </f:facet>  
                        <h:outputText value="#{rec.deliveryOrderIdStr}" />  

                    </p:column>

                    <p:column sortBy="#{rec.status}">  
                        <f:facet name="header">  
                            <h:outputText value="Order Status" />  
                        </f:facet>  
                        <h:outputText value="#{rec.status}" />  
                    </p:column>

                    <p:column sortBy="#{rec.leadTimeTS}">  
                        <f:facet name="header">  
                            <h:outputText value="Shipping Date" />  
                        </f:facet>  
                        <h:outputText value="#{rec.leadTimeTS}">
                            <f:convertDateTime pattern="dd-MMM-yyyy"/>
                        </h:outputText>
                    </p:column>

                    <p:column>  
                        <f:facet name="header">  
                            <h:outputText value="Option" />  
                        </f:facet>  
                        <p:commandButton image="ui-icon ui-icon-circle-triangle-e" value="Picking" title="Go to Picking Order" action="#{lcManagerBean.viewPickingOrder(rec.id)}"/> &nbsp;
                        <p:commandButton image="ui-icon ui-icon-circle-triangle-e" value="Packing" title="Go to Packing Order" action="#{lcManagerBean.viewPackingOrder(rec.id)}" disabled="#{lcManagerBean.disablePacking(rec.id)}"/> &nbsp;
                        <p:commandButton image="ui-icon ui-icon-circle-triangle-e" value="Shipping" title="Go to Shipping Order" action="#{lcManagerBean.viewShippingOrder(rec.id)}" disabled="#{lcManagerBean.disableShipping(rec.id)}"/> &nbsp;
                    </p:column>
                </p:dataTable>

                <br/>
                <br/>
                <br/>
                <br/>
                <br/>
                <h:outputText value="Order Completed" style="font-weight: bold; font-size: 110%"/>
                <p:separator/>
                <br/>
                <p:dataTable var="rec" value="#{lcManagerBean.processedOrderList}" paginator="true" rows="10">

                    <p:column sortBy="#{rec.deliveryOrderIdStr}">
                        <f:facet name="header">
                            <h:outputText value="Delivery Order #" />  
                        </f:facet>  
                        <h:outputText value="#{rec.deliveryOrderIdStr}" />  

                    </p:column>

                    <p:column sortBy="#{rec.status}">  
                        <f:facet name="header">  
                            <h:outputText value="Order Status" />  
                        </f:facet>  
                        <h:outputText value="#{rec.status}" />  
                    </p:column>

                    <p:column sortBy="#{rec.leadTimeTS}">  
                        <f:facet name="header">  
                            <h:outputText value="Shipping Date" />  
                        </f:facet>  
                        <h:outputText value="#{rec.leadTimeTS}">
                            <f:convertDateTime pattern="dd-MMM-yyyy"/>
                        </h:outputText>
                    </p:column>

                    <p:column>  
                        <f:facet name="header">  
                            <h:outputText value="Option" />  
                        </f:facet>  
                        <p:commandButton image="ui-icon ui-icon-search" action="#{lcManagerBean.viewShippingOrder(rec.id)}"/>
                    </p:column>
                </p:dataTable>

                <br/>
                <br/>
            </p:panel>
            <br/>
        </h:form>
    </ui:define>

    <ui:define name="bottom">

    </ui:define>

</ui:composition>
